package com.miyake.loveviewweb.shared;

import org.apache.commons.lang.ArrayUtils;

public class CsvConverter {

    public static synchronized String get(String[] str) {
        String ret  ="";
        for (int i = 0; i < str.length; i++) {
            ret += str[i];
            if (i < str.length-1) {
                ret += ",";
            }
        }
        return ret;
    }
    
    public static synchronized String get(Double[] dbl) {
        return get(ArrayUtils.toPrimitive(dbl));
    }
    
    public static synchronized String get(double[] dbl) {
        String ret = "";
        for (int i = 0; i < dbl.length; i++) {
            ret += String.valueOf(dbl[i]);
            if (i < dbl.length-1) {
                ret += ",";
            }
        }
        return ret;
    }
    
    public static synchronized String getCsv(Double[] dbl) {
        return get(ArrayUtils.toPrimitive(dbl));
    }
}
